#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class QTreeWidgetItem;
class QLabel;
class QSpinBox;

class MainWindow : public QMainWindow
{
    Q_OBJECT

private:
    enum treeColNum { colItem = 0, colItemType, colDate };
    // QTreeWidgetItem item type
    // 0~1000 Qt defined
    // 1001~ +∞ User defined
    enum treeItemType { itTopItem = 1001, itGroupItem, itImageItem };
    void changeItemCaption(QTreeWidgetItem *item);

    QLabel *labFileName;
    QLabel *labNodeText;
    QSpinBox *spinRatio;

    QPixmap m_pixmp; // 显示图片
    float m_ratio;   // 图片缩放因子

    void displayImage(QTreeWidgetItem *item);

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_actAddFolder_triggered();

    void on_actAddFile_triggered();

    void on_actDeleteItem_triggered();

    void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);

    void on_actScanItems_triggered();

    void on_actZoomFitWidth_triggered();

    void on_actZoomFitHeight_triggered();

    void on_actActualSize_triggered();

    void on_actZoomIn_triggered();

    void on_actZoomOut_triggered();

    void on_actDockVisible_triggered(bool checked);

    void on_actDockFloat_triggered(bool checked);

    void on_dockWidget_visibilityChanged(bool visible);

    void on_dockWidget_topLevelChanged(bool topLevel);

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
